<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title></title>
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="static/css/bootstrap.min.css" />
		<link rel="stylesheet" href="static/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="static/css/font-awesome.min.css" />
		<!-- 下拉框 -->
		<link rel="stylesheet" href="static/css/chosen.css" />
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		<link rel="stylesheet" href="static/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		<style type="text/css">
		input, textarea, .uneditable-input {
		    width: 306px;
		}
		</style>
		<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
		<!--提示框-->
		<script type="text/javascript" src="static/js/jquery.tips.js"></script>
		
		<script type="text/javascript">
			$(document).ready(function(){
				if($("#brand_id").val()!=""){
					$("#brand_name_zh").attr("readonly","readonly");
					$("#brand_name_zh").css("color","gray");
				}
			});
			
			//保存
			function save(){
				if($("#brand_name_zh").val()=="" || $("#brand_name_zh").val()=="此 品牌已存在!"){
					$("#brand_name_zh").tips({
						side:3,
			            msg:'输入品牌名称',
			            bg:'#AE81FF',
			            time:2
			        });
					
					$("#brand_name_zh").focus();
					$("#brand_name_zh").val('');
					$("#brand_name_zh").css("background-color","white");
					return false;
				}else{
					$("#brand_name_zh").val(jQuery.trim($('#brand_name_zh').val()));
				}
				
				$("#brandForm").submit();
				$("#centerOfMainFrame").hide();
				$("#centerOfMainFrame2").show();
			}
			
			function delBigtp(tpurl,id){
				 if(confirm("确定要删除大图吗？")){
					$.ajax({
						type : "POST",
						url : "product/brand/delBigtp/"+tpurl+"/"+id+ ".json",
						//data:JSON.stringify(catacode),
						contentType:"application/json",  //发送至服务器的类型
						dataType : "json",     //预期服务器返回类型
						success: function(data){
							//alert(data.string);
							//return false;
							if(data.string=="success"){
								alert("删除成功!");
								document.location.reload();
							}
						}
					})
				} 
			}
			
			function delThintp(tpurl,id){
				 if(confirm("确定要删除小图吗？")){
					$.ajax({
						type : "POST",
						url : "product/brand/delThintp/"+tpurl+"/"+id+ ".json",
						//data:JSON.stringify(catacode),
						contentType:"application/json",  //发送至服务器的类型
						dataType : "json",     //预期服务器返回类型
						success: function(data){
							//alert(data.string);
							//return false;
							if(data.string=="success"){
								alert("删除成功!");
								document.location.reload();
							}
						}
					})
				} 
			}
		</script>
	</head>
<body>
	<form action="<%=basePath%>/product/brand/editProductBrand.do" name="brandForm" id="brandForm" method="post" enctype="multipart/form-data">
		<input type="hidden" name="currentselectorganid" id="currentselectproductbrandid" value="${pageData.currentselectproductbrandid }"/>
		<input type="hidden" name="brand_id" id="brand_id" value="${pageData.brand_id }"/>
		<div id="centerOfMainFrame">
			<table>
				<tr>
					<td>上级品牌：<input type="text" width="300px" name="parentproductBrandname" id="parentproductBrandname" maxlength="32" value="${pageData.parentproductBrandname }" title="上级品牌名称" readonly="readonly"/></td>
				</tr>
				<tr>
					<td>品牌名称：<input type="text" name="brand_name_zh" id="brand_name_zh" maxlength="32" placeholder="这里输入品牌名称" value="${pageData.brand_name_zh }" title="品牌名称"/></td>
				</tr>
				<tr>
					<td>品牌简称：<input type="text" name="brand_name_fo" id="brand_name_fo"  maxlength="32" placeholder="这里输入品牌简称" value="${pageData.brand_name_fo }" title="品牌简称"/></td>
				</tr>
				<tr>
					<td>品牌大图：
						<c:if test="${pageData == null || pageData.brand_logo_big == '' || pageData.brand_logo_big == null }">
							<input type="file" id="brand_logo_big" name="brand_logo_big"/>
						</c:if>
						<c:if test="${pageData != null && pageData.brand_logo_big != '' && pageData.brand_logo_big != null }">
							<a href="${pageData.brand_logo_big}" target="_blank"><img src="${pageData.brand_logo_big}" width="210"/></a>
							<input type="button" class="btn btn-mini btn-danger" value="删除" onclick="delBigtp('${pageData.brand_logo_big}','${pageData.brand_id }');" />
							<input type="hidden" name="brand_logo_bighidden" id="brand_logo_bighidden" value="${pageData.brand_logo_big }"/>
						</c:if>
					</td>
				</tr>
				<tr>
					<td>品牌小图：
						<c:if test="${pageData == null || pageData.brand_logo_thin == '' || pageData.brand_logo_thin == null }">
							<input type="file" id="brand_logo_thin" name="brand_logo_thin"/>
						</c:if>
						<c:if test="${pageData != null && pageData.brand_logo_thin != '' && pageData.brand_logo_thin != null }">
							<a href="${pageData.brand_logo_thin}" target="_blank"><img src="${pageData.brand_logo_thin}" width="80"/></a>
							<input type="button" class="btn btn-mini btn-danger" value="删除" onclick="delThintp('${pageData.brand_logo_thin}','${pageData.brand_id }');" />
							<input type="hidden" name="brand_logo_bighidden" id="brand_logo_bighidden" value="${pageData.brand_logo_thin }"/>
						</c:if>
					</td>
				</tr>
				<tr>
					<td>品牌官网：<input type="text" name="brand_site" id="brand_site"  maxlength="32" placeholder="这里输入品牌官网" value="${pageData.brand_site }" title="品牌官网"/></td>
				</tr>
				<tr>
					<td>品牌描述：<textarea name="brand_desc" id="brand_desc" cols="100" rows="10" placeholder="这里输入品牌描述" title="品牌描述">${pageData.brand_desc }</textarea></td>
				</tr>
				<tr>
					<td style="text-align: center;">
						<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
						<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
					</td>
				</tr>
			</table>
		</div>
		<input type="hidden" name="token" value="${token}" />
		<div id="centerOfMainFrame2" class="center" style="display:none"><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green"></h4></div>
	</form>
	
		<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
	<script type="text/javascript" src="static/js/ace.min.js"></script>
	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 单选框 -->
	<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
	<!-- 编辑框-->
	<script type="text/javascript">
	$(top.hangge());
	$(function() {
		//单选框
		$(".chzn-select").chosen(); 
		$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
		
		//上传
		$('#brand_logo_big').ace_file_input({
			no_file:'请选择图片 ...',
			btn_choose:'选择',
			btn_change:'更改',
			droppable:false,
			onchange:null,
			thumbnail:false //| true | large
			//whitelist:'gif|png|jpg|jpeg'
			//blacklist:'exe|php'
			//onchange:''
			//
		});
		
		//上传
		$('#brand_logo_thin').ace_file_input({
			no_file:'请选择图片 ...',
			btn_choose:'选择',
			btn_change:'更改',
			droppable:false,
			onchange:null,
			thumbnail:false //| true | large
			//whitelist:'gif|png|jpg|jpeg'
			//blacklist:'exe|php'
			//onchange:''
			//
		});
		
	});
	</script>
</body>
</html>